'''
while 循环
for 循环
break:终止循环
continue:跳过当前循环直接进入下一个循环
return:也可以终止循环
'''
# 死循环
# while True:
#     print("hello")
#打印1到100
i = 1
while i <=100:
    print(i)
    i = i + 1

#打印矩形9行9列
j = 1
while j <=9:
    print("*********")
    j = j + 1

print("")

#打印矩形9行9列，每一行的*也用循环打印
j = 1
while j <=9:
    m = 1
    while m <= 9 :
        print("*",end="")
        m = m + 1
    print("")
    j = j + 1
#打印三角形
j = 1
while j <=9:
    m = 1
    while m <= j :
        print("*",end="")
        m = m + 1
    print("")
    j = j + 1

#打印乘法口诀表
j = 1
while j <=9:
    m = 1
    while m <= j :
        print("%d*%d=%d "%(m,j,m*j),end="")
        m = m + 1
    print("")
    j = j + 1

#求和案例 求100之内和
sumResult= 0
i = 1
while i <=100:
    sumResult = sumResult + i
    i = i + 1
print(sumResult)
#求和案例 求100之内偶数的和
sumResult= 0
i = 1
while i <=100:
    if i % 2 == 0:
        sumResult = sumResult + i
    i = i + 1
print(sumResult)

#for循环  遍历容器  像字符串 列表 集合 ...
#直接遍历本身
str1 = "hello everybody"
alist = [10,2,289,88,993,332,3,8,9,0,11]
for s in str1:
    print(s)
for a in alist:
    print(a)
#指定区间遍历
for i in range(0,10):
    print(i)
#指定区间遍历 指定步伐
for i in range(0,10,2):
    print(i)
#指定区间遍历 倒序取数
for i in range(10,0,-1):
    print(i)
for i in range(0,len(str1)):
    print(i)
    print(str1[i])
sumResult = 0
for i in range(1,101):
    sumResult = sumResult + i
print(sumResult)

#100以内的偶数求和
sumResult = 0
for i in range(1,101):
    if i % 2 == 0:
        sumResult = sumResult + i
print(sumResult)

#打印矩形
for i in range(0,9):
    print("*********")

print("")

#打印矩形 使用内循环
for i in range(0,9):
    for j in range(0,9):
        print("*",end="")
    print("")

#打三角形 使用内循环
for i in range(0,9):
    for j in range(0,i+1):
        print("*",end="")
    print("")

#打印乘法口诀表
for i in range(1,10):
    for j in range(1,i+1):
        print("%d*%d=%d "%(j,i,j*i),end="")
    print("")

while True:
    n = int(input("请输入人工服务0  查询话费1 查询流量2 充值3 挂断4"))
    if n == 0:
        print("很高兴为您服务")
    elif n == 1:
        print("您的话费余额为999")
    elif n == 2:
        print("您的流量为9999g")
    elif n == 3:
        print("充值成功")
    elif n == 4:
        print("期待下次为您服务")
        break
    else:
        print("请规范您的输入规格")